﻿<Window x:Class="CPPEI.Coolzon.Designer.Views.DataSetWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CPPEI.Coolzon.Designer.Views"
        xmlns:ui="clr-namespace:CPPEI.Coolzon.UI;assembly=CPPEI.Coolzon.UI"
        xmlns:metadata="clr-namespace:CPPEI.Coolzon.Metadata;assembly=CPPEI.Coolzon.Metadata"
        xmlns:parameter="clr-namespace:CPPEI.Coolzon.ServiceProxy.DesignServiceRef;assembly=CPPEI.Coolzon.ServiceProxy"
        mc:Ignorable="d"
        Title="数据集" WindowStartupLocation="CenterScreen"  Height="400" MinWidth="400" Width="741" Closing="Window_Closing"      
        Style="{DynamicResource WindowStyle}">
    <Window.Resources>
        <ObjectDataProvider x:Key="CacheModeData" MethodName="GetValues" ObjectType="{x:Type metadata:CacheMode}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="metadata:CacheMode"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>
    <Grid x:Name="_ctlGrid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="360"/>
            <ColumnDefinition Width="150"/>
            <ColumnDefinition Width="220"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="66"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="faName" Text="名称" Grid.Column="0" Grid.Row="0" Margin="3,5,3,3" />
            <TextBlock x:Name="faCaption" Text="描述" Grid.Column="0" Grid.Row="1" Margin="3,5,3,3" />
            <TextBlock x:Name="faType" Text="类型" Grid.Column="0" Grid.Row="2" Margin="3,5,3,3" />
            <TextBlock Text="值" Grid.Column="0" Grid.Row="3" Margin="3,5,3,3" />

            <TextBlock x:Name="faCacheMode" Text="缓存模式" Grid.Column="0" Grid.Row="4" Margin="3,5,3,3" />

            <ui:NameTextbox x:Name="_ctltbName" MaxLength="50" Grid.Column="1" Grid.Row="0" Text="{Binding Path=Name, Mode=OneTime}"  MaxWidth="300" Margin="3,3,3,3" />
            <TextBox x:Name="_ctltbCaption" MaxLength="50" Grid.Column="1" Grid.Row="1" Text="{Binding Path=Caption, Mode=OneTime}" MaxWidth="300" Margin="3,3,3,3"  />
            <ComboBox x:Name="_ctlType" Grid.Column="1" Grid.Row="2" SelectedItem="{Binding Path=Type, Mode=OneTime}" MaxWidth="300" Margin="3,3,3,3" Loaded="_ctlType_Loaded"/>
            <TextBox x:Name="_ctltbValueString" MaxLength="200" Grid.Column="1" Grid.Row="3" Text="{Binding Path=ValueString, Mode=OneTime}" MaxWidth="300" Margin="3,3,3,3"/>
            <ComboBox x:Name="_ctlcbCacheMode" MaxWidth="300" Grid.Column="1" Grid.Row="4" Margin="3,3,3,3" ItemsSource="{Binding Source={StaticResource CacheModeData}}" SelectedItem="{Binding Path=CacheMode, Mode=OneTime}">
            </ComboBox>
        </Grid>

        <GroupBox Grid.Row="0" Grid.Column="1" Header="参数列表" >
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="19*"/>
                    <ColumnDefinition Width="50*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <StackPanel Style="{DynamicResource ButtonPanelBackground}" Grid.Row="0" Orientation="Horizontal" Grid.ColumnSpan="2">
                    <Button Style="{DynamicResource AddButtonStyle}" Name="_ctlAdd" FontSize="15" VerticalContentAlignment="Center" Width="36" Height="25" Margin="3" ToolTip="增加" Click="_ctlAdd_Click"/>
                    <Button Style="{DynamicResource RemoveButtonStyle}"  Name="_ctlRemove" FontSize="15" Width="36" Margin="3" ToolTip="删除" Click="_ctlRemove_Click"/>
                </StackPanel>
                <ListView x:Name="_ctlParameterList" Grid.Row="1"  Grid.ColumnSpan="2" SelectionChanged="_ctlParameterList_SelectionChanged" >
                    <ListView.ItemTemplate>
                        <DataTemplate DataType="parameter:DataParameter" >
                            <TextBlock Text="{Binding Name}" ToolTip="{Binding Caption}"/>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </Grid>
        </GroupBox>
        <GroupBox  Grid.Row="0" Grid.Column="2" Header="参数信息">
            <Grid x:Name="_ctlParameter" IsEnabled="False" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="66"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Text="名称" Grid.Column="0" Grid.Row="0" Margin="3,5,3,3" />
                <TextBlock Text="描述" Grid.Column="0" Grid.Row="1" Margin="3,5,3,3" />
                <TextBlock Text="类型" Grid.Column="0" Grid.Row="2" Margin="3,5,3,3" />
                <TextBlock Text="值类型" Grid.Column="0" Grid.Row="3" Margin="3,5,3,3" />

                <ui:NameTextbox x:Name="_ctltbParamName" MaxLength="50" Grid.Column="1" Grid.Row="0" Text="{Binding Path=Name,Mode=TwoWay}"   Margin="3,3,3,3" />
                <TextBox x:Name="_ctltbParamCaption" MaxLength="50" Grid.Column="1" Grid.Row="1" Text="{Binding Path=Caption,Mode=TwoWay}" Margin="3,3,3,3"  />

                <ComboBox x:Name="_ctlParamType" Grid.Column="1" Grid.Row="2" SelectedItem="{Binding Path=Type,Mode=TwoWay}" Margin="3,3,3,3"  />
                <TextBox x:Name="_ctltbParamValueType" MaxLength="50" Grid.Column="1" Grid.Row="3" Text="{Binding Path=ValueType,Mode=TwoWay}" Margin="3,3,3,3"   />
            </Grid>
        </GroupBox>
        <Grid Grid.Row="2" Grid.ColumnSpan="3">
            <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Content="确定" Margin="0,0,20,0" Click="Button_Click" Width="75" />
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="cancel" Content="取消" Margin="20,0,0,0" Click="cancel_Click" Width="75"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
